﻿Public Class Menu
    
    Private Sub KeToanTienMat_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Cursor = Cursors.WaitCursor
        'TODO: This line of code loads data into the 'ErpharmaDataSet.menuitem' table. You can move, or remove it, as needed.
        Me.MenuitemTableAdapter1.Fill(Me.ErpharmaDataSet.menuitem)
        'TODO: This line of code loads data into the 'ErpharmaDataSet.menu' table. You can move, or remove it, as needed.
        Me.MenuTableAdapter1.Fill(Me.ErpharmaDataSet.menu)
        Me.DmthoigianIUltraCombo.setDataTable(Me.ErpharmaDataSet.dmthoigian) 'iultracombo

        'set doi tuong cho ultragrid
        Me.KetoantienmatIUltraGrid_DanhSach.setDoiTuongXuLyDuLieu(Me.ErpharmaDataSet.menu, Me.MenuBindingSource, Me.MenuTableAdapter, Me.ErpharmaDataSet)
        Me.MenuitemIUltraGrid.setDoiTuongXuLyDuLieu(Me.ErpharmaDataSet.menuitem, Me.MenuitemBindingSource, Me.MenuitemTableAdapter, Me.ErpharmaDataSet)

        'set giao dien
        Me.MenuitemIUltraGrid.setGiaoDienTuyBien()
        Me.KetoantienmatIUltraGrid_DanhSach.setGiaoDienTuDong()
        Me.DmthoigianIUltraCombo.setGiaoDien()
        
      
        'set tìm kiếm
        Me.KetoantienmatIUltraGrid_DanhSach.setTimKiemTrenCotUltraGrid()
        Me.Ketoantienmatchitiet_ThongTinChinh_TimKiem_IUltraGrid.setTimKiemTrenCotUltraGrid()

        
        'set group by - iultragrid timkiem
        Me.Ketoantienmatchitiet_ThongTinChinh_TimKiem_IUltraGrid.setGroupBy("ma")

        'set menustrip
        Me.MenuitemIUltraGrid.setChoPhepMenuStrip()
       
        'set focus
        'Me.KetoantienmatIUltraGrid_ThongTin.setFocusIUltraGrid("tinhtrang", Me.Ketoantienmatchitiet_ThongTinChinh_IUltraGrid)
        'Me.Ketoantienmatchitiet_ThongTinChinh_IUltraGrid.setFocusIUltraGrid("nguonvon", Me.Ketoantienmatchitiet_ThongTinKhaiThue_IUltraGrid)
        Me.Cursor = Cursors.Default
    End Sub

    Private Sub btnTaoMoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTaoMoi.Click

        Me.KetoantienmatIUltraGrid_ThongTin.getTaoMoi()
    End Sub

    Private Sub btnLuu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLuu.Click
        If Me.KetoantienmatIUltraGrid_ThongTin.getLuu() Then
        End If
    End Sub

    Private Sub btnXoa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnXoa.Click
        Me.KetoantienmatIUltraGrid_ThongTin.getXoa()
    End Sub

    Private Sub btnLamTuoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLamTuoi.Click
        Me.KetoantienmatIUltraGrid_ThongTin.getRefresh()
    End Sub

    Private Sub btnIn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnIn.Click

    End Sub

    Private Sub btnThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnThoat.Click
        Me.Dispose()
        Me.Close()
    End Sub

    'Private Sub Ketoantienmatchitiet_ThongTinKhaiThue_IUltraGrid_AfterCellActivate(ByVal sender As Object, ByVal e As System.EventArgs)
    '    'If Me.Ketoantienmatchitiet_ThongTinKhaiThue_IUltraGrid.ActiveRow.Cells("sohoadon").IsActiveCell Then
    '    '    Me.UltraTabControl2.SelectedTab = Me.UltraTabControl2.Tabs(1)
    '    'End If
    'End Sub

    Private Sub Ketoantienmatchitiet_ThongTinChinh_TimKiem_IUltraGrid_ClickCell(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.ClickCellEventArgs) Handles Ketoantienmatchitiet_ThongTinChinh_TimKiem_IUltraGrid.ClickCell
        If Me.Ketoantienmatchitiet_ThongTinChinh_TimKiem_IUltraGrid.ActiveRow.Index <> -1 Then
            Try
                Me.MenuBindingSource.Position = Me.MenuBindingSource.Find("ma", Me.Ketoantienmatchitiet_ThongTinChinh_TimKiem_IUltraGrid.ActiveRow.Cells("ma").Value)
            Catch ex As Exception
            End Try
        End If
    End Sub

    Private Sub KetoantienmatIUltraGrid_ThongTin_BeforeCellDeactivate(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles KetoantienmatIUltraGrid_ThongTin.BeforeCellDeactivate
        Me.KetoantienmatIUltraGrid_ThongTin.setFocusCellUltraGrid(Me.MenuitemIUltraGrid)

    End Sub

    
End Class